package com.ycsj.goldmedalnewconcept.adapter;

import android.content.Context;
import android.content.Intent;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.ycsj.goldmedalnewconcept.R;
import com.ycsj.goldmedalnewconcept.activity.RedPackageGetRecordActivity;
import com.ycsj.goldmedalnewconcept.bean.PackInfo;

import java.util.List;

//import base.CommonAdapter;
//import base.ViewHolder;

/**
 * 创建日期：2017/11/7  15:21
 * 描述:红包记录的列表适配器
 * 作者:张伟
 */

public class PackLvAdapter extends CommonAdapter<PackInfo.RedPacketsBean> {
    private Context context;

    public PackLvAdapter(Context context, List<PackInfo.RedPacketsBean> datas, int layoutId) {
        super(context, datas, layoutId);
        this.context = context;
    }

    @Override
    public void convert(ViewHolder holder, final PackInfo.RedPacketsBean bean) {
        //最外层的布局
        LinearLayout llOut = holder.getView(R.id.ll_out);

        //左边的图标
        ImageView lvLeft = holder.getView(R.id.lv_left);

        //标题
        TextView tvName = holder.getView(R.id.tv_name);
        tvName.setText(bean.getTitle());

        //时间
        TextView tvTime = holder.getView(R.id.tv_time);
        tvTime.setText(bean.getCreateDate() + "");

        //数量
        TextView tvNum = holder.getView(R.id.tv_money);
        tvNum.setText(bean.getMoney() + "");

        //右边的相对布局
        RelativeLayout rlRight = holder.getView(R.id.rl_right);

        //最外层控件的点击事件
//        llOut.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View view) {
//                // 跳转到红包领取
//                Intent intent = new Intent(context, RedPackageGetRecordActivity.class);
//                intent.putExtra("redid", bean.getRedId() + "");
//                context.startActivity(intent);
//            }
//        });

    }
}
